import { http } from "@/utils/http";

/** 获取保安信息 */

export type SecurityInfo = {
  workId: number;
  workName: string;
  workIdentity: number;
  workPartId: number;
  workStatus: number;
  workPhone: string;
};

export type GetSecurityResult = {
  list: Array<SecurityInfo>;
  total: number;
};

export const getSecurity = (params?: object) => {
  return http.request<GetSecurityResult>("get", "/api/manager/view/guard", {
    params
  });
};

/** 添加保安 */

export type AddSecurityInfo = {
  workId: number;
  workName: string;
  workIdentity: number;
  workPartId: number;
  workStatus: number;
  workPhone: string;
  workAppid: number;
};

export type AddSecurityResult = {
  code: string;
  msg: string;
  data: null;
};

export const addSecurity = (data?: AddSecurityInfo) => {
  return http.request<AddSecurityResult>(
    "post",
    "/api/tmxk/jhx/moudles/addWorker",
    {
      data
    }
  );
};

/** 删除安保人员 */

export type DeleteSecurityResult = {
  code: string;
  msg: string;
  data: null;
};

export const deleteSecurity = (data?: Array<number>) => {
  return http.request<DeleteSecurityResult>(
    "post",
    "/api/tmxk/jhx/moudles/deleteWorker",
    {
      data
    }
  );
};

/** 获取巡检信息 */

export type PatrolInfo = {
  id: number;
  taskCode: number;
  deviceName: string;
  progress: number;
  adeviceAddress: string;
  createTime: string;
};

export type GetPatrolResult = {
  list: Array<PatrolInfo>;
  total: number;
};

export const getPatrol = (params?: object) => {
  return http.request<GetPatrolResult>("get", "/api/manager/view/guard/task", {
    params
  });
};
